From: Gert Wollny Date: Thu, 22 Jun 2017 10:00:31 +0000 (+0000) Subject: Update time compare patch X-Git-Tag: archive/raspbian/3.6.9-4+rpi1^2~227 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=c3d3080f17667c387b5b7dfbffc9814c4cfe4123;p=dcmtk.git Update time compare patch --- diff --git a/debian/patches/09_round_time.patch b/debian/patches/09_round_time.patch index f4f3464e..8cf7a1bc 100644 --- a/debian/patches/09_round_time.patch +++ b/debian/patches/09_round_time.patch @@ -5,14 +5,38 @@ Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859204 --- a/ofstd/libsrc/oftime.cc +++ b/ofstd/libsrc/oftime.cc -@@ -491,6 +491,10 @@ +@@ -47,6 +47,7 @@ + #include "dcmtk/ofstd/oftime.h" + #include "dcmtk/ofstd/ofstd.h" + ++#include + + /*------------------* + * implementation * +@@ -99,13 +100,16 @@ + + OFBool OFTime::operator==(const OFTime &timeVal) const + { +- return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) == timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/)); ++ // Dicom supports at most 6 decimal digits, to compare cut off to eliminate numerical errors. ++ double me = rint(getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000); ++ double other = rint(timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) * 1000000); ++ return me == other; + } + + + OFBool OFTime::operator!=(const OFTime &timeVal) const + { +- return (getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/) != timeVal.getTimeInSeconds(OFTrue /*useTimeZone*/, OFFalse /*normalize*/)); ++ return ! (*this == timeVal); + } + + +@@ -491,6 +495,7 @@ { /* compute number of seconds since 00:00:00 */ double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second; + -+ /* Dicom supports only six decimal digits, but floating point operations might introduce errors */ -+ result = round(result * 1000000.0) / 1000000.0; -+ /* normalize the result to the range [0.0,86400.0[ */ if (normalize) result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400);